package org.ptkparty.client;

import org.ptkparty.client.request.PTKPartyRequestFactory;
import org.ptkparty.client.view.championships.ChampionshipsView;
import org.ptkparty.client.view.games.AddGameView;
import org.ptkparty.client.view.games.PrepareGamesView;
import org.ptkparty.client.view.games.ResultsView;
import org.ptkparty.client.view.games.ShowGameView;
import org.ptkparty.client.view.place.PlacesView;
import org.ptkparty.client.view.players.PlayersView;
import org.ptkparty.client.view.profil.ProfilView;
import org.ptkparty.client.view.scales.ScalesView;
import org.ptkparty.client.view.stats.StatsView;
import org.ptkparty.shared.service.PTKService;
import org.ptkparty.shared.service.PTKServiceAsync;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.place.shared.PlaceController;
import com.google.web.bindery.event.shared.EventBus;
import com.google.web.bindery.event.shared.SimpleEventBus;

public class ClientFactory {

	private static final EventBus eventBus = new SimpleEventBus();
	private static final PlaceController placeController = new PlaceController((com.google.web.bindery.event.shared.EventBus) eventBus);
	private PTKPartyRequestFactory factory;

	private PTKServiceAsync ptkService = GWT.create(PTKService.class);

	public PTKPartyRequestFactory getFactory() {
		if (factory == null) {
			factory = GWT.create(PTKPartyRequestFactory.class);
			factory.initialize(getEventBus());
		}
		return factory;
	}

	public EventBus getEventBus() {
		return eventBus;
	}

	public PlaceController getPlaceController() {
		return placeController;
	}

	public ProfilView getProfilView() {
		return new ProfilView();
	}

	public ChampionshipsView getChampionchipView() {
		return new ChampionshipsView();
	}

	public PlayersView getPlayersView() {
		return new PlayersView();
	}

	public ScalesView getScalesView() {
		return new ScalesView();
	}

	public PTKServiceAsync getPtkService() {
		return ptkService;
	}

	public AddGameView getAddGameView() {
		return new AddGameView();
	}

	public ResultsView getResultsView() {
		return new ResultsView();
	}

	public ShowGameView getShowGamesView() {
		return new ShowGameView();
	}

	public PrepareGamesView getPrepareGameView() {
		return new PrepareGamesView();
	}

	public StatsView getStatsView() {
		return new StatsView();
	}

	public PlacesView getPlacesView() {
		return new PlacesView();
	}

}
